﻿using System;
using System.Collections.Generic;
using System.Drawing.Drawing2D;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.DB;
using StairsModuleAndEdit.StairsModel.CommonUnit;
using StairsModuleAndEdit.StairsModel.DataInfos;

namespace StairsModuleAndEdit.StairsModel.Kit
{
	public class DoubleBranchParallelStairsKit : ProjectionDrawingKit
	{
		public DoubleBranchParallelStairsKit(Application app) : base(app)
		{
		}

		private void CreateStairsBeamCurves(ref DoubleBranchParallelStairs stairs, bool bCenterStart, XYZ ptLandTopLeft, XYZ ptLandTopRight, bool bBottom, bool bMid, bool bLand, bool bTop)
		{
			LineRunData midRunData = stairs.m_MidRunData;
			LineRunData leftRunData = stairs.m_LeftRunData;
			XYZ xyz = new XYZ(0.0, stairs.m_BeamData.BeamWidth / 2.0, 0.0);
			if (bCenterStart)
			{
				XYZ ptS = XYZ.Zero;
				XYZ ptE = XYZ.Zero;
				if (bBottom)
				{
					List<CurveInfo> list = new List<CurveInfo>();
					ptS = midRunData.PtRunBottomLeft - xyz;
					ptE = midRunData.PtRunBottomRight - xyz;
					list.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, ptS, ptE, xyz));
					double bottomElevation = midRunData.BottomElevation;
					BeamCurveInfo beamCurveInfo = new BeamCurveInfo(list, bottomElevation);
					beamCurveInfo.m_Type = BeamType.BT_Bottom;
					beamCurveInfo.m_nFloorNum = 0;
					stairs.m_listBeamCurve.Add(beamCurveInfo);
				}
				if (bMid)
				{
					List<CurveInfo> list2 = new List<CurveInfo>();
					if (stairs.m_MidRunData.TreadCount > stairs.m_LeftRunData.TreadCount)
					{
						XYZ xyz2 = new XYZ(stairs.m_dWellWidth + stairs.m_LeftRunData.RunWidth, 0.0, 0.0);
						ptS = stairs.m_MidRunData.PtRunTopLeft - xyz2 + xyz;
						ptE = stairs.m_MidRunData.PtRunTopRight + xyz2 + xyz;
					}
					else
					{
						ptS = stairs.m_LeftRunData.PtRunTopLeft + xyz;
						ptE = stairs.m_RightRunData.PtRunTopRight + xyz;
					}
					list2.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, ptS, ptE, null));
					double bottomElevation = leftRunData.BottomElevation;
					BeamCurveInfo beamCurveInfo2 = new BeamCurveInfo(list2, bottomElevation);
					beamCurveInfo2.m_Type = BeamType.BT_Mid;
					beamCurveInfo2.m_nFloorNum = 1;
					stairs.m_listBeamCurve.Add(beamCurveInfo2);
				}
				if (bLand)
				{
					List<CurveInfo> list3 = new List<CurveInfo>();
					ptS = ptLandTopLeft - xyz;
					ptE = ptLandTopRight - xyz;
					list3.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, ptS, ptE, null));
					double bottomElevation = leftRunData.BottomElevation;
					BeamCurveInfo beamCurveInfo3 = new BeamCurveInfo(list3, bottomElevation);
					beamCurveInfo3.m_Type = BeamType.BT_Land;
					beamCurveInfo3.m_nFloorNum = 1;
					stairs.m_listBeamCurve.Add(beamCurveInfo3);
				}
				if (bTop)
				{
					List<CurveInfo> list4 = new List<CurveInfo>();
					ptS = stairs.m_LeftRunData.PtRunBottomLeft - xyz;
					ptE = stairs.m_LeftRunData.PtRunBottomRight - xyz;
					list4.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, ptS, ptE, -xyz));
					ptS = stairs.m_RightRunData.PtRunBottomLeft - xyz;
					ptE = stairs.m_RightRunData.PtRunBottomRight - xyz;
					list4.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, ptS, ptE, -xyz));
					double bottomElevation = leftRunData.BottomElevation + leftRunData.RunHeight - midRunData.TreadHeight;
					BeamCurveInfo beamCurveInfo4 = new BeamCurveInfo(list4, bottomElevation);
					beamCurveInfo4.m_Type = BeamType.BT_Top;
					beamCurveInfo4.m_nFloorNum = 2;
					stairs.m_listBeamCurve.Add(beamCurveInfo4);
					return;
				}
			}
			else
			{
				XYZ ptS2 = XYZ.Zero;
				XYZ ptE2 = XYZ.Zero;
				if (bBottom)
				{
					List<CurveInfo> list5 = new List<CurveInfo>();
					ptS2 = stairs.m_LeftRunData.PtRunBottomLeft - xyz;
					ptE2 = stairs.m_LeftRunData.PtRunBottomRight - xyz;
					list5.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, ptS2, ptE2, xyz));
					ptS2 = stairs.m_RightRunData.PtRunBottomLeft - xyz;
					ptE2 = stairs.m_RightRunData.PtRunBottomRight - xyz;
					list5.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, ptS2, ptE2, xyz));
					double bottomElevation2 = leftRunData.BottomElevation;
					BeamCurveInfo beamCurveInfo5 = new BeamCurveInfo(list5, bottomElevation2);
					beamCurveInfo5.m_Type = BeamType.BT_Bottom;
					beamCurveInfo5.m_nFloorNum = 0;
					stairs.m_listBeamCurve.Add(beamCurveInfo5);
				}
				if (bMid)
				{
					List<CurveInfo> list6 = new List<CurveInfo>();
					if (stairs.m_MidRunData.TreadCount > stairs.m_LeftRunData.TreadCount)
					{
						XYZ xyz3 = new XYZ(stairs.m_dWellWidth + stairs.m_LeftRunData.RunWidth, 0.0, 0.0);
						ptS2 = stairs.m_MidRunData.PtRunTopLeft - xyz3 + xyz;
						ptE2 = stairs.m_MidRunData.PtRunTopRight + xyz3 + xyz;
					}
					else
					{
						ptS2 = stairs.m_LeftRunData.PtRunTopLeft + xyz;
						ptE2 = stairs.m_RightRunData.PtRunTopRight + xyz;
					}
					list6.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, ptS2, ptE2, null));
					double bottomElevation2 = midRunData.BottomElevation;
					BeamCurveInfo beamCurveInfo6 = new BeamCurveInfo(list6, bottomElevation2);
					beamCurveInfo6.m_Type = BeamType.BT_Mid;
					beamCurveInfo6.m_nFloorNum = 1;
					stairs.m_listBeamCurve.Add(beamCurveInfo6);
				}
				if (bLand)
				{
					List<CurveInfo> list7 = new List<CurveInfo>();
					ptS2 = ptLandTopLeft - xyz;
					ptE2 = ptLandTopRight - xyz;
					list7.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, ptS2, ptE2, null));
					double bottomElevation2 = midRunData.BottomElevation;
					BeamCurveInfo beamCurveInfo7 = new BeamCurveInfo(list7, bottomElevation2);
					beamCurveInfo7.m_Type = BeamType.BT_Land;
					beamCurveInfo7.m_nFloorNum = 1;
					stairs.m_listBeamCurve.Add(beamCurveInfo7);
				}
				if (bTop)
				{
					List<CurveInfo> list8 = new List<CurveInfo>();
					ptS2 = midRunData.PtRunBottomLeft - xyz;
					ptE2 = midRunData.PtRunBottomRight - xyz;
					list8.Add(base.NewLine(PenColor.PC_Gray, DashStyle.Solid, 1f, ptS2, ptE2, -xyz));
					double bottomElevation2 = midRunData.BottomElevation + midRunData.RunHeight - midRunData.TreadHeight;
					BeamCurveInfo beamCurveInfo8 = new BeamCurveInfo(list8, bottomElevation2);
					beamCurveInfo8.m_Type = BeamType.BT_Top;
					beamCurveInfo8.m_nFloorNum = 2;
					stairs.m_listBeamCurve.Add(beamCurveInfo8);
				}
			}
		}

		private void DrawDoubleBranchParallelLanding(ref List<CurveInfo> landingEdgeLoop, BaseLandingData landingData, XYZ ptBaseLB, XYZ ptBaseRB, XYZ ptBaseLM, XYZ ptBaseRM, XYZ ptBaseRT, XYZ ptBaseLT, LineRunData runLeft, LineRunData runRight, LineRunData runMid, double dWellWidth, int nTreadAlign)
		{
			if (runMid.TreadCount != runLeft.TreadCount && LandingType.LT_None != landingData.TheType && (1E-09 < landingData.Width || (LandingType.LT_Sector == landingData.TheType && 1E-09 >= landingData.Width)))
			{
				if (runMid.TreadCount > runLeft.TreadCount)
				{
					if (nTreadAlign == 0)
					{
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseLB, ptBaseRB, null));
					}
					else
					{
						XYZ xyz = new XYZ(dWellWidth, 0.0, 0.0);
						XYZ xyz2 = new XYZ(runLeft.RunWidth, 0.0, 0.0);
						XYZ xyz3 = ptBaseLB + xyz2;
						XYZ xyz4 = ptBaseLM - xyz;
						XYZ xyz5 = ptBaseRM + xyz;
						XYZ xyz6 = ptBaseRB - xyz2;
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseLB, xyz3, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, xyz3, xyz4, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, xyz4, xyz5, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, xyz5, xyz6, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, xyz6, ptBaseRB, null));
					}
				}
				else
				{
					double num = -Math.Abs(runLeft.RunLength - runMid.RunLength);
					if (1 == nTreadAlign)
					{
						XYZ xyz7 = new XYZ(runLeft.RunWidth + dWellWidth, 0.0, 0.0);
						XYZ xyz8 = ptBaseLB + xyz7;
						XYZ xyz9 = ptBaseRB - xyz7;
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseLB, xyz8, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, xyz8, ptBaseLM, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseLM, ptBaseRM, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseRM, xyz9, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, xyz9, ptBaseRB, null));
					}
					else if (2 == nTreadAlign)
					{
						XYZ xyz10 = new XYZ(0.0, num, 0.0);
						XYZ xyz11 = new XYZ(runLeft.RunWidth, 0.0, 0.0);
						new XYZ(runRight.RunWidth, 0.0, 0.0);
						XYZ xyz12 = new XYZ(runMid.RunWidth + 2.0 * dWellWidth, 0.0, 0.0);
						XYZ xyz13 = ptBaseLB + xyz11;
						XYZ xyz14 = xyz13 + xyz10;
						XYZ xyz15 = xyz14 + xyz12;
						XYZ xyz16 = xyz13 + xyz12;
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseLB, xyz13, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, xyz13, xyz14, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, xyz14, xyz15, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, xyz15, xyz16, null));
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, xyz16, ptBaseRB, null));
					}
					else
					{
						landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseLB, ptBaseRB, null));
					}
				}
			}
			else if (runMid.TreadCount == runLeft.TreadCount && landingData.TheType != LandingType.LT_None && (1E-09 < landingData.Width || (LandingType.LT_Sector == landingData.TheType && 1E-09 >= landingData.Width)))
			{
				landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseLB, ptBaseRB, null));
			}
			if (landingData.TheType == LandingType.LT_Rect && 1E-09 < landingData.Width)
			{
				landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseRB, ptBaseRT, null));
				landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseRT, ptBaseLT, null));
				landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseLT, ptBaseLB, null));
				return;
			}
			if (LandingType.LT_Sector == landingData.TheType)
			{
				if (1E-09 < landingData.Width || (runMid.TreadCount > runLeft.TreadCount && nTreadAlign != 0))
				{
					landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseRB, ptBaseRT, null));
				}
				double num2 = runLeft.RunWidth + runMid.RunWidth + runRight.RunWidth + 2.0 * dWellWidth;
				XYZ xyz17 = Geometry.CalculatMidPoint(ptBaseLT, ptBaseRT);
				XYZ xyz18 = new XYZ(0.0, num2 / 2.0, 0.0);
				XYZ ptM = xyz17 + xyz18;
				landingEdgeLoop.Add(base.NewArc(PenColor.PC_Gray, DashStyle.Solid, 2f, ptBaseRT, ptBaseLT, ptM));
				if (1E-09 < landingData.Width || (runMid.TreadCount > runLeft.TreadCount && nTreadAlign != 0))
				{
					landingEdgeLoop.Add(base.NewLine(PenColor.PC_Black, DashStyle.Solid, 2f, ptBaseLT, ptBaseLB, null));
				}
			}
		}

		private void DrawDoubleBranceParallelNoteInfo(ref DoubleBranchParallelStairs stairs, XYZ ptBaseLTL, XYZ ptBaseLBL, XYZ ptBaseRBL, XYZ ptBaseLBR, XYZ ptBaseRBR, XYZ ptBaseLBM, XYZ ptBaseRBM, bool bCenterStart)
		{
			double stairsWidth = stairs.getStairsWidth();
			double width = stairs.m_LandData.Width;
			double dWellWidth = stairs.m_dWellWidth;
			double treadDepth = stairs.m_LeftRunData.TreadDepth;
			XYZ xyz = ptBaseLTL + XYZ.BasisX * stairsWidth;
			XYZ xyz2 = ptBaseLTL + XYZ.BasisY * width + XYZ.BasisY * 1.5;
			XYZ xyz3 = xyz + XYZ.BasisY * width + XYZ.BasisY * 1.5;
			if (LandingType.LT_Sector == stairs.m_LandData.TheType)
			{
				XYZ xyz4 = Geometry.CalculatMidPoint(xyz2, xyz3);
				XYZ xyz5 = new XYZ(0.0, stairsWidth / 2.0, 0.0);
				xyz4 += xyz5;
				xyz2 += XYZ.BasisY * (xyz4.Y - xyz2.Y);
				xyz3 += XYZ.BasisY * (xyz4.Y - xyz3.Y);
			}
			base.DrawStairsNoteInfo(ref stairs.m_listOtherCurve, ref stairs.m_listText, xyz2, xyz3, "梯间宽度", 0.8, 5.0, 2.0, XYZ.BasisY, PenColor.PC_Black);
			XYZ ptStart = ptBaseLBL - XYZ.BasisY * 2.0;
			XYZ ptEnd = ptBaseRBL - XYZ.BasisY * 2.0;
			base.DrawStairsNoteInfo(ref stairs.m_listOtherCurve, ref stairs.m_listText, ptStart, ptEnd, "边梯段宽", 0.8, 5.0, 2.0, -XYZ.BasisY, PenColor.PC_Black);
			ptStart = ptBaseLBR - XYZ.BasisY * 2.0;
			ptEnd = ptBaseRBR - XYZ.BasisY * 2.0;
			base.DrawStairsNoteInfo(ref stairs.m_listOtherCurve, ref stairs.m_listText, ptStart, ptEnd, "边梯段宽", 0.8, 5.0, 2.0, -XYZ.BasisY, PenColor.PC_Black);
			ptStart = ptBaseLBM - XYZ.BasisY * 2.0;
			ptEnd = ptBaseRBM - XYZ.BasisY * 2.0;
			base.DrawStairsNoteInfo(ref stairs.m_listOtherCurve, ref stairs.m_listText, ptStart, ptEnd, "中梯段宽", 0.8, 5.0, 2.0, -XYZ.BasisY, PenColor.PC_Black);
			if (1E-09 < width)
			{
				XYZ xyz6 = ptBaseLTL + XYZ.BasisY * width;
				XYZ ptStart2 = ptBaseLTL - XYZ.BasisX * 1.5;
				XYZ ptEnd2 = xyz6 - XYZ.BasisX * 1.5;
				base.DrawStairsNoteInfo(ref stairs.m_listOtherCurve, ref stairs.m_listText, ptStart2, ptEnd2, "休息平台", 0.8, 2.0, 5.0, -XYZ.BasisX, PenColor.PC_Black);
			}
			XYZ xyz7 = ptBaseRBR + XYZ.BasisY * treadDepth;
			XYZ ptStart3 = xyz7 + XYZ.BasisX * 1.5;
			XYZ ptEnd3 = ptBaseRBR + XYZ.BasisX * 1.5;
			base.DrawStairsNoteInfo(ref stairs.m_listOtherCurve, ref stairs.m_listText, ptStart3, ptEnd3, "踏步宽度", 0.8, 2.0, 5.0, XYZ.BasisX, PenColor.PC_Black);
			if (1E-09 <= dWellWidth)
			{
				XYZ ptStart4;
				XYZ ptEnd4;
				if (1E-09 <= ptBaseLBM.Y)
				{
					ptStart4 = ptBaseRBL - XYZ.BasisY * 5.0;
					ptEnd4 = ptBaseRBL + XYZ.BasisX * dWellWidth - XYZ.BasisY * 5.0;
				}
				else
				{
					ptStart4 = ptBaseLBM - XYZ.BasisX * dWellWidth - XYZ.BasisY * 5.0;
					ptEnd4 = ptBaseLBM - XYZ.BasisY * 5.0;
				}
				base.DrawStairsNoteInfo(ref stairs.m_listOtherCurve, ref stairs.m_listText, ptStart4, ptEnd4, "梯井宽", 0.8, 5.0, 2.0, -XYZ.BasisY, PenColor.PC_Black);
				if (1E-09 <= ptBaseLBM.Y)
				{
					ptStart4 = ptBaseLBR - XYZ.BasisX * dWellWidth - XYZ.BasisY * 5.0;
					ptEnd4 = ptBaseLBR - XYZ.BasisY * 5.0;
				}
				else
				{
					ptStart4 = ptBaseRBM - XYZ.BasisY * 5.0;
					ptEnd4 = ptBaseRBM + XYZ.BasisX * dWellWidth - XYZ.BasisY * 5.0;
				}
				base.DrawStairsNoteInfo(ref stairs.m_listOtherCurve, ref stairs.m_listText, ptStart4, ptEnd4, "梯井宽", 0.8, 5.0, 2.0, -XYZ.BasisY, PenColor.PC_Black);
			}
		}

		private void DrawUpStairsNoteInfo(ref DoubleBranchParallelStairs param_stairs, bool bCenterStart)
		{
			LineRunData leftRunData = param_stairs.m_LeftRunData;
			LineRunData midRunData = param_stairs.m_MidRunData;
			LineRunData rightRunData = param_stairs.m_RightRunData;
			XYZ xyz = XYZ.BasisY * 1.0;
			List<UpDownText> list = new List<UpDownText>();
			string sText = "上";
			string sText2 = "下";
			if (bCenterStart)
			{
				XYZ pos = Geometry.CalculatMidPoint(midRunData.PtRunBottomLeft, midRunData.PtRunBottomRight) - xyz;
				XYZ pos2 = Geometry.CalculatMidPoint(leftRunData.PtRunBottomLeft, leftRunData.PtRunBottomRight) - xyz;
				XYZ pos3 = Geometry.CalculatMidPoint(rightRunData.PtRunBottomLeft, rightRunData.PtRunBottomRight) - xyz;
				UpDownText item = new UpDownText(pos, sText);
				list.Add(item);
				item = new UpDownText(pos2, sText2);
				list.Add(item);
				item = new UpDownText(pos3, sText2);
				list.Add(item);
				base.DrawUpDownNoteInfo(ref param_stairs.m_listText, list);
				return;
			}
			XYZ pos4 = Geometry.CalculatMidPoint(midRunData.PtRunBottomLeft, midRunData.PtRunBottomRight) - xyz;
			XYZ pos5 = Geometry.CalculatMidPoint(leftRunData.PtRunBottomLeft, leftRunData.PtRunBottomRight) - xyz;
			XYZ pos6 = Geometry.CalculatMidPoint(rightRunData.PtRunBottomLeft, rightRunData.PtRunBottomRight) - xyz;
			UpDownText item2 = new UpDownText(pos4, sText2);
			list.Add(item2);
			item2 = new UpDownText(pos5, sText);
			list.Add(item2);
			item2 = new UpDownText(pos6, sText);
			list.Add(item2);
			base.DrawUpDownNoteInfo(ref param_stairs.m_listText, list);
		}

		public bool LinearDoubleBranchParallelStarisProfileCurves(ref DoubleBranchParallelStairs stairs, bool bDrawNoteInfo, int nTreadAlignType, int basePointIndex, bool lrMirror, bool tbMirror, double rotateAngle, bool bBottom, bool bMid, bool bLand, bool bTop)
		{
			bool result = false;
			LineRunData leftRunData = stairs.m_LeftRunData;
			LineRunData midRunData = stairs.m_MidRunData;
			LineRunData rightRunData = stairs.m_RightRunData;
			double dWellWidth = stairs.m_dWellWidth;
			double width = stairs.m_LandData.Width;
			double stairsWidth = stairs.getStairsWidth();
			double num = Geometry.LessThan(leftRunData.RunLength, midRunData.RunLength) ? midRunData.RunLength : leftRunData.RunLength;
			double bundingBoxHeight = num + width;
			XYZ ptLandTopLeft = XYZ.Zero;
			XYZ ptLandTopRight = XYZ.Zero;
			XYZ zero = XYZ.Zero;
			XYZ xyz = new XYZ(leftRunData.RunWidth, 0.0, 0.0);
			XYZ xyz2 = new XYZ(leftRunData.RunWidth, leftRunData.RunLength, 0.0);
			XYZ xyz3 = new XYZ(0.0, leftRunData.RunLength, 0.0);
			XYZ xyz4 = new XYZ(leftRunData.RunWidth + dWellWidth, 0.0, 0.0);
			XYZ xyz5 = xyz4;
			XYZ xyz6 = new XYZ(midRunData.RunWidth, 0.0, 0.0) + xyz4;
			XYZ xyz7 = new XYZ(midRunData.RunWidth, midRunData.RunLength, 0.0) + xyz4;
			XYZ xyz8 = new XYZ(0.0, midRunData.RunLength, 0.0) + xyz4;
			XYZ xyz9 = new XYZ(leftRunData.RunWidth + dWellWidth * 2.0 + midRunData.RunWidth, 0.0, 0.0);
			XYZ xyz10 = xyz9;
			XYZ xyz11 = new XYZ(rightRunData.RunWidth, 0.0, 0.0) + xyz9;
			XYZ xyz12 = new XYZ(rightRunData.RunWidth, rightRunData.RunLength, 0.0) + xyz9;
			XYZ xyz13 = new XYZ(0.0, rightRunData.RunLength, 0.0) + xyz9;
			if (midRunData.TreadCount > leftRunData.TreadCount)
			{
				double num2 = midRunData.RunLength - leftRunData.RunLength;
				if (nTreadAlignType == 0)
				{
					XYZ xyz14 = new XYZ(0.0, num2, 0.0);
					xyz5 -= xyz14;
					xyz6 -= xyz14;
					xyz7 -= xyz14;
					xyz8 -= xyz14;
				}
				else if (1 == nTreadAlignType)
				{
					XYZ xyz15 = new XYZ(0.0, num2 / 2.0, 0.0);
					xyz5 -= xyz15;
					xyz6 -= xyz15;
					xyz7 -= xyz15;
					xyz8 -= xyz15;
				}
			}
			else
			{
				double num3 = Math.Abs(leftRunData.RunLength - midRunData.RunLength);
				if (nTreadAlignType == 0)
				{
					XYZ xyz16 = new XYZ(0.0, num3, 0.0);
					xyz5 += xyz16;
					xyz6 += xyz16;
					xyz7 += xyz16;
					xyz8 += xyz16;
				}
				else if (1 == nTreadAlignType)
				{
					XYZ xyz17 = new XYZ(0.0, num3 / 2.0, 0.0);
					xyz5 += xyz17;
					xyz6 += xyz17;
					xyz7 += xyz17;
					xyz8 += xyz17;
				}
			}
			stairs.m_MidRunData.PtRunBottomLeft = xyz5;
			stairs.m_MidRunData.PtRunBottomRight = xyz6;
			stairs.m_MidRunData.PtRunTopLeft = xyz8;
			stairs.m_MidRunData.PtRunTopRight = xyz7;
			stairs.m_LeftRunData.PtRunBottomLeft = zero;
			stairs.m_LeftRunData.PtRunBottomRight = xyz;
			stairs.m_LeftRunData.PtRunTopLeft = xyz3;
			stairs.m_LeftRunData.PtRunTopRight = xyz2;
			stairs.m_RightRunData.PtRunBottomLeft = xyz10;
			stairs.m_RightRunData.PtRunBottomRight = xyz11;
			stairs.m_RightRunData.PtRunTopLeft = xyz13;
			stairs.m_RightRunData.PtRunTopRight = xyz12;
			List<XYZ> list = new List<XYZ>();
			if (1E-09 >= stairs.m_LandData.Width || LandingType.LT_None == stairs.m_LandData.TheType)
			{
				list.Add(zero);
				list.Add(xyz11);
				stairs.m_listOutSupportPoints.Add(zero);
				stairs.m_listOutSupportPoints.Add(xyz3);
				stairs.m_listOutSupportPoints.Add(xyz12);
				stairs.m_listOutSupportPoints.Add(xyz11);
			}
			else
			{
				XYZ item;
				XYZ item2;
				if (leftRunData.TreadCount >= midRunData.TreadCount)
				{
					double num4 = leftRunData.RunLength + width;
					item = new XYZ(0.0, num4, 0.0);
					item2 = new XYZ(stairsWidth, num4, 0.0);
				}
				else if (nTreadAlignType == 0)
				{
					double num5 = leftRunData.RunLength + width;
					item = new XYZ(0.0, num5, 0.0);
					item2 = new XYZ(stairsWidth, num5, 0.0);
				}
				else if (2 == nTreadAlignType)
				{
					double num6 = midRunData.RunLength + width;
					item = new XYZ(0.0, num6, 0.0);
					item2 = new XYZ(stairsWidth, num6, 0.0);
				}
				else
				{
					XYZ xyz18 = xyz8 - XYZ.BasisX * (dWellWidth + leftRunData.RunWidth) + XYZ.BasisY * width;
					item = new XYZ(zero.X, xyz18.Y, 0.0);
					item2 = new XYZ(xyz11.X, xyz18.Y, 0.0);
				}
				list.Add(zero);
				list.Add(item);
				list.Add(item2);
				list.Add(xyz11);
				stairs.m_listOutSupportPoints.Add(zero);
				stairs.m_listOutSupportPoints.Add(xyz3);
				stairs.m_listOutSupportPoints.Add(xyz12);
				stairs.m_listOutSupportPoints.Add(xyz11);
				stairs.m_listOutSupportPoints.Add(item);
				stairs.m_listOutSupportPoints.Add(item2);
			}
			XYZ xyz19 = list[basePointIndex];
			base.CalulateTransform(lrMirror, tbMirror, rotateAngle, stairsWidth, bundingBoxHeight, xyz19);
			stairs.m_ptPosition = Geometry.TransformPoint(xyz19, this.m_Transform);
			stairs.m_listOtherCurve.AddRange(base.DrawBasePoint(xyz19, 100.0));
			stairs.m_Transform = this.m_Transform;
			double bottomElevation;
			if (stairs.m_bIsCenterUp)
			{
				SingleRunCurveInfo singleRunCurveInfo = new SingleRunCurveInfo();
				singleRunCurveInfo.BottomElevation = midRunData.BottomElevation;
				base.DrawLinearRun(midRunData, xyz5, xyz6, xyz7, xyz8, ref singleRunCurveInfo, ref stairs.m_listOtherCurve, bDrawNoteInfo);
				stairs.m_listRunCurve.Add(singleRunCurveInfo);
				singleRunCurveInfo = new SingleRunCurveInfo();
				singleRunCurveInfo.BottomElevation = leftRunData.BottomElevation;
				base.DrawLinearRun(leftRunData, xyz2, xyz3, zero, xyz, ref singleRunCurveInfo, ref stairs.m_listOtherCurve, bDrawNoteInfo);
				stairs.m_listRunCurve.Add(singleRunCurveInfo);
				singleRunCurveInfo = new SingleRunCurveInfo();
				singleRunCurveInfo.BottomElevation = rightRunData.BottomElevation;
				base.DrawLinearRun(rightRunData, xyz12, xyz13, xyz10, xyz11, ref singleRunCurveInfo, ref stairs.m_listOtherCurve, bDrawNoteInfo);
				stairs.m_listRunCurve.Add(singleRunCurveInfo);
				bottomElevation = leftRunData.BottomElevation;
			}
			else
			{
				SingleRunCurveInfo singleRunCurveInfo2 = new SingleRunCurveInfo();
				singleRunCurveInfo2.BottomElevation = leftRunData.BottomElevation;
				base.DrawLinearRun(leftRunData, zero, xyz, xyz2, xyz3, ref singleRunCurveInfo2, ref stairs.m_listOtherCurve, bDrawNoteInfo);
				stairs.m_listRunCurve.Add(singleRunCurveInfo2);
				singleRunCurveInfo2 = new SingleRunCurveInfo();
				singleRunCurveInfo2.BottomElevation = rightRunData.BottomElevation;
				base.DrawLinearRun(rightRunData, xyz10, xyz11, xyz12, xyz13, ref singleRunCurveInfo2, ref stairs.m_listOtherCurve, bDrawNoteInfo);
				stairs.m_listRunCurve.Add(singleRunCurveInfo2);
				singleRunCurveInfo2 = new SingleRunCurveInfo();
				singleRunCurveInfo2.BottomElevation = midRunData.BottomElevation;
				base.DrawLinearRun(midRunData, xyz7, xyz8, xyz5, xyz6, ref singleRunCurveInfo2, ref stairs.m_listOtherCurve, bDrawNoteInfo);
				stairs.m_listRunCurve.Add(singleRunCurveInfo2);
				bottomElevation = midRunData.BottomElevation;
			}
			XYZ xyz20 = new XYZ(0.0, width, 0.0);
			List<CurveInfo> landCurves = new List<CurveInfo>();
			if (leftRunData.TreadCount >= midRunData.TreadCount)
			{
				ptLandTopLeft = xyz3 + xyz20;
				ptLandTopRight = xyz12 + xyz20;
				this.DrawDoubleBranchParallelLanding(ref landCurves, stairs.m_LandData, xyz3, xyz12, xyz8, xyz7, xyz12 + xyz20, xyz3 + xyz20, leftRunData, rightRunData, midRunData, stairs.m_dWellWidth, nTreadAlignType);
			}
			else
			{
				XYZ xyz21 = xyz8 - XYZ.BasisX * (dWellWidth + rightRunData.RunWidth) + xyz20;
				XYZ xyz22 = xyz7 + XYZ.BasisX * (dWellWidth + rightRunData.RunWidth) + xyz20;
				ptLandTopLeft = xyz21;
				ptLandTopRight = xyz22;
				this.DrawDoubleBranchParallelLanding(ref landCurves, stairs.m_LandData, xyz3, xyz12, xyz8, xyz7, xyz22, xyz21, leftRunData, rightRunData, midRunData, stairs.m_dWellWidth, nTreadAlignType);
			}
			LandingCurveInfo item3 = new LandingCurveInfo(landCurves, bottomElevation);
			stairs.m_listLandCurve.Add(item3);
			this.CreateStairsBeamCurves(ref stairs, stairs.m_bIsCenterUp, ptLandTopLeft, ptLandTopRight, bBottom, bMid, bLand, bTop);
			if (leftRunData.TreadCount >= midRunData.TreadCount)
			{
				this.DrawDoubleBranceParallelNoteInfo(ref stairs, xyz3, zero, xyz, xyz10, xyz11, xyz5, xyz6, stairs.m_bIsCenterUp);
			}
			else
			{
				this.DrawDoubleBranceParallelNoteInfo(ref stairs, xyz8 - XYZ.BasisX * (leftRunData.RunWidth + dWellWidth), zero, xyz, xyz10, xyz11, xyz5, xyz6, stairs.m_bIsCenterUp);
			}
			if (bDrawNoteInfo)
			{
				this.DrawUpStairsNoteInfo(ref stairs, stairs.m_bIsCenterUp);
			}
			return result;
		}
	}
}
